{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "News_Article.ipynb",
      "version": "0.3.2",
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    }
  },
  "cells": [
    {
      "cell_type": "code",
      "metadata": {
        "id": "SXkcmdB7NQqa",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "#Description: Scrape and Summarize News Articles\n",
        "\n",
        "#pip install nltk\n",
        "#pip install newspaper3k\n",
        "\n",
        "#Resources: Documentation: https://newspaper.readthedocs.io/en/latest/?source=post_page---------------------------\n",
        "#           Medium Article: https://towardsdatascience.com/scrape-and-summarize-news-articles-in-5-lines-of-python-code-175f0e5c7dfc\n",
        "#           Article Website: https://www.washingtonpost.com/technology/2019/07/17/you-downloaded-faceapp-heres-what-youve-just-done-your-privacy/?noredirect=on&utm_term=.f8b0b55b2805\n"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "K5GXXqgyNmj2",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "#Import the libraries\n",
        "import nltk\n",
        "from newspaper import Article"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "m-Hm25CpNvDh",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "#Get the article\n",
        "url = 'https://www.washingtonpost.com/technology/2019/07/17/you-downloaded-faceapp-heres-what-youve-just-done-your-privacy/?noredirect=on&utm_term=.1938589d078f'\n",
        "article = Article(url)"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "aZFwoAC5OAin",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 52
        },
        "outputId": "7b0e50af-3114-425b-d62b-99739170ff75"
      },
      "source": [
        "# Do some NLP\n",
        "article.download()\n",
        "article.parse()\n",
        "nltk.download('punkt')\n",
        "article.nlp()"
      ],
      "execution_count": 3,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "[nltk_data] Downloading package punkt to /root/nltk_data...\n",
            "[nltk_data]   Package punkt is already up-to-date!\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "YBjmuOylOLbz",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 141
        },
        "outputId": "b5af3c76-fa48-42df-da59-b0cefab4946a"
      },
      "source": [
        "#Get the authors\n",
        "article.authors"
      ],
      "execution_count": 4,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "['Geoffrey A. Fowler',\n",
              " 'Technology Columnist Based In San Francisco',\n",
              " 'Technology Columnist',\n",
              " 'Geoffrey A. Fowler Is The Washington Post S Technology Columnist Based In San Francisco. He Joined The Post In After Years With The Wall Street Journal Writing About Consumer Technology',\n",
              " 'Silicon Valley',\n",
              " 'National Affairs']"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 4
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "3MXz_MQWOW8i",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 35
        },
        "outputId": "cd3f1c78-e815-4041-f3f8-a06080556aa9"
      },
      "source": [
        "#Get the publish date\n",
        "article.publish_date"
      ],
      "execution_count": 5,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "datetime.datetime(2019, 7, 17, 0, 0)"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 5
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "K7IzbWL_Oedn",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 55
        },
        "outputId": "c1d0cad7-36c1-45cb-a926-0f2c1f519c4f"
      },
      "source": [
        "#Get the top image \n",
        "article.top_image"
      ],
      "execution_count": 6,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "'https://www.washingtonpost.com/resizer/JGS0Z2IB3PMcQr0zWU69TNxo0cQ=/1484x0/arc-anglerfish-washpost-prod-washpost.s3.amazonaws.com/public/J76RFFMEIVAJ3NTZ4YEXMMBJGQ.jpg'"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 6
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "YR88_6lzOluT",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        },
        "outputId": "92662294-4085-41c1-9130-784c95192dc8"
      },
      "source": [
        "#Get the article text\n",
        "print(article.text)"
      ],
      "execution_count": 7,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Technology columnist\n",
            "\n",
            "When an app goes viral, how can you know whether it’s all good fun — or covertly violating your privacy by, say, sending your face to the Russian government?\n",
            "\n",
            "That’s the burning question about FaceApp, a program that takes photos of people and “ages” them using artificial intelligence. Soon after it shot to the top of the Apple and Google store charts this week, privacy advocates began waving warning flags about the Russian-made app’s vague legalese. Word spread quickly that the app might be a disinformation campaign or secretly downloading your entire photo album. Leaders of the Democratic party warned campaigns to delete the app ‘immediately.’\n",
            "\n",
            "[Schumer calls for investigation into FaceApp over security concerns and Russia ties]\n",
            "\n",
            "I got some answers by running my own forensic analysis and talking to the CEO of the company that made the app. But the bigger lesson was how much app-makers and the stores run by Apple and Google leave us flying blind when it comes to privacy.\n",
            "\n",
            "I raised similar questions a few weeks ago when I ran an experiment to find out what my iPhone did while I slept at night. I found apps sending my personal information to all sorts of tracking companies I’d never heard of.\n",
            "\n",
            "So what about FaceApp? It was vetted by Apple’s App Store and Google’s Play Store, which even labeled it an “Editors’ Choice.” They both link to its privacy policy — which they know nobody reads.\n",
            "\n",
            "[I found your data. It’s for sale.]\n",
            "\n",
            "Looking under the hood of FaceApp with the tools from my iPhone test, I found it sharing information about my phone with Facebook and Google AdMob, which probably help it place ads and check the performance of its ads. The most unsettling part was how much data FaceApp was sending to its own servers, after which … who knows what happens. It’s not just your own face that FaceApp might gobble up — if you age friends or family members, their face gets uploaded, too.\n",
            "\n",
            "\n",
            "\n",
            "FaceApp, which uses artificial intelligence to \"age\" people, has gone viral. Tech columnist Geoffrey A. Fowler tried it himself — and explored the privacy implications. (Geoffrey Fowler/The Washington Post)\n",
            "\n",
            "[FaceApp adds decades to your age for fun, but the popular, Russian-owned app raises privacy concerns]\n",
            "\n",
            "In an email exchange, FaceApp CEO Yaroslav Goncharov tried to clarify some of that.\n",
            "\n",
            "These five questions are basics we ought to know about any app or service that wants something as personal as our faces.\n",
            "\n",
            "1. What data do they take?\n",
            "\n",
            "FaceApp uploads and processes our photos in the cloud, Goncharov said, but the app will “only upload a photo selected by a user for editing.” The rest of your camera roll stays on your phone. You can also use FaceApp without giving it your name or email — and 99 percent of users do just that, he said.\n",
            "\n",
            "2. How long do they hold on my data?\n",
            "\n",
            "The app’s terms of service grant it a “perpetual” license to our photos. Goncharov said FaceApp deletes “most” of the photos from its servers after 48 hours.\n",
            "\n",
            "[Help Desk: Ask our tech columnist a question]\n",
            "\n",
            "3. What are they doing with my data?\n",
            "\n",
            "Is FaceApp using our faces and the maps it makes of them for anything other than the express purpose of the app, such as running facial identification on us? “No,” Goncharov said. Legally, though, the app’s terms give it — and whoever might buy it or work with it in the future — the right to do whatever it wants, through an “irrevocable, nonexclusive, royalty-free, worldwide, fully-paid, transferrable sub-licensable license.” (Clear as mud?)\n",
            "\n",
            "4. Who has access to my data?\n",
            "\n",
            "Do government authorities in Russia have access to our photos? “No,” Goncharov said. FaceApp’s engineers are based in Russia, so our data is not transferred there. He said the company also doesn’t “sell or share any user data with any third parties” — aside, I pointed out, from what it shares with trackers from Facebook and AdMob. (Another exception: Users in Russia may have their data stored in Russia.)\n",
            "\n",
            "5. How can I delete my data?\n",
            "\n",
            "Just deleting the app won’t get rid of the photos FaceApp may have in the cloud. Goncharov said people can put in a request to delete all data from FaceApp’s servers, but the process is convoluted. “For the fastest processing, we recommend sending the requests from the FaceApp mobile app using ‘Settings->Support->Report a bug’ with the word ‘privacy’ in the subject line. We are working on the better UI [user interface] for that,” he said.\n",
            "\n",
            "[Opinion: Here's what the FaceApp freak out really tells us]\n",
            "\n",
            "Why not post this information to FaceApp’s website, beyond the legalese? “We are planning to make some improvements,” Goncharov said.\n",
            "\n",
            "Same question for the app stores run by Apple and Google. Those giant companies make money from a cut of upgrades you can purchase in the app. We’re literally paying them to read the privacy policies — and vet that companies such as FaceApp are telling the truth. Why not better help us understand right where we download what’s really going on? Neither company replied with an on-the-record comment.\n",
            "\n",
            "Much better to help us sort through all of this before millions of us upload our faces somewhere we might regret.\n",
            "\n",
            "Read more tech advice and analysis from Geoffrey A. Fowler:\n",
            "\n",
            "Goodbye, Chrome: Google’s Web browser has become spy software\n",
            "\n",
            "Not all iPhones are the same. These cost less and are better for the Earth.\n",
            "\n",
            "Rock this way: AirPods, Beats and Bose wireless ear buds take the headbang test\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "FYIgTTvvO3M_",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 124
        },
        "outputId": "76379d49-d328-4f96-c50d-ba35b3a44c05"
      },
      "source": [
        "#Get a summary of the article\n",
        "print(article.summary)"
      ],
      "execution_count": 8,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "The most unsettling part was how much data FaceApp was sending to its own servers, after which … who knows what happens.\n",
            "Just deleting the app won’t get rid of the photos FaceApp may have in the cloud.\n",
            "“For the fastest processing, we recommend sending the requests from the FaceApp mobile app using ‘Settings->Support->Report a bug’ with the word ‘privacy’ in the subject line.\n",
            "[Opinion: Here's what the FaceApp freak out really tells us]Why not post this information to FaceApp’s website, beyond the legalese?\n",
            "We’re literally paying them to read the privacy policies — and vet that companies such as FaceApp are telling the truth.\n"
          ],
          "name": "stdout"
        }
      ]
    }
  ]
}
